package com.example.zlw.dem2;

import java.util.function.Supplier;

/**
 * @program: Zlw
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-11-04 20:50
 **/

/**
 *  实例方法引用练习
 */
public class Test {
    public static void main(String[] args) {
        School school = new School("3A","联盟峡谷");
        //lambda表达形式
        // Supplier<String> supplier=()->school.getName();
        //实例方法引用
        Supplier<String> supplier=school::getName;
        String s = supplier.get();
        System.out.println(s);
    }
}
class School{
    private String name;
    private String address;

    public School(String name,String address) {
        this.name = name;
        this.address = address;
    }

    @Override
    public String toString() {
        return "School{" +
                "name='" + name + '\'' +
                ", address='" + address + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
